set :user, 'designteam9'  # Your dreamhost account's username
set :domain, 'sopo.scehardt.com'  # Dreamhost servername where your account is located
set :project, 'sopo'  # Your application as its called in the repository
set :application, 'sopo.scehardt.com'  # Your app's location (domain or sub-domain name as setup in panel)
set :applicationdir, "/home/#{user}/#{application}"  # The standard Dreamhost setup

# version control config
set :scm_username, 'hubert.c.liu@gmail.com'
set :scm_password, 'vY4Ft9ag2na4'
set :repository,  "https://jhad-sopo.googlecode.com/svn/sopo/trunk"

# roles (servers)
role :web, domain
role :app, domain
role :db,  domain, :primary => true

# deploy config
set :deploy_to, applicationdir
set :deploy_via, :export

# additional settings
default_run_options[:pty] = true  # Forgo errors when deploying from windows
#ssh_options[:keys] = %w(/Path/To/id_rsa)            # If you are using ssh_keys
set :chmod755, "app config db lib public vendor script script/* public/disp*"
set :use_sudo, false

namespace :deploy do
  desc "Link in the production config yml files"
  task :link_configs do
    puts "linking configs..."
    run "ln -nfs #{applicationdir}/shared/database.yml #{current_path}/config/database.yml"
    run("chmod +x #{current_path}/script/process/reaper")
  end
end

namespace :permissions do
  desc "Set permissions for folders"
  task :set_permissions do
    puts "setting permissions"
    run("chmod -R 755 #{current_path}/public")
    run("chmod -R 775 #{current_path}/log")
    run("chmod -R 775 #{current_path}/tmp")
    run("chmod -R 775 #{current_path}/script")
  end
end

after "deploy:symlink", "deploy:link_configs"
after :deploy, "permissions:set_permissions"

deploy.task :start do
  # nothing
end


